/**
 * @author LinYiSong
 */
$(function() {
	
	$("#mul-del").hide();
	var wid = $(".table").width();
	$(".page-no").width(wid);
	
	//全选,反选,取消
	$(".select_btn").click(function(event){
        var seleteType = $(this).attr("name");
		var flag=$('#check-td').attr("checked");
        $(".table :checkbox").each(function(i){
            var e = $(".table :checkbox").eq(i);
            switch (seleteType) {
                case 'select_all':
                    e.attr("checked", true);
                    break;
                case 'select_reverse':
                    e.attr("checked", !e.attr("checked"));
                    break;
                case 'select_cancel':
                    e.attr("checked", false);
                    break;
				case 'check-td':					
					e.attr("checked",flag);
					break;
            }
        })
		checkCheckbox();
    });
    $(".table :checkbox").click(function(event){
	    checkCheckbox();        
    });
	$(".table :checkbox").click(function(event){
	    checkCheckbox();        
    });
    });
function isDelete() {

	return confirm("您确认删该对象吗？");
}

/**
 * 判断table中的checkbox是否选中
 */
function checkCheckbox(){
	var had_select = 0;
        $(".table :checkbox").each(function(i){
            if ($(".table :checkbox").eq(i).attr("checked") == true) {
                had_select = 1;
            }
        });
        if (had_select == 1) {
            $("#mul-del").show();
        }else{
            $("#mul-del").hide();
			
		}
}